home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August (Alt) / CHIP 2005-08.1.iso / program / guvenlik / syslinux-3.07.exe / regdump.inc < prev    next >
Encoding:
Text File  |  2004-12-14  |  1.7 KB  |  112 lines

  1. ;; $Id: regdump.inc,v 1.2 2004/12/14 22:46:25 hpa Exp $
  2. ;; -----------------------------------------------------------------------
  3. ;;
  4. ;;   Copyright 2003 H. Peter Anvin - All Rights Reserved
  5. ;;
  6. ;;   This program is free software; you can redistribute it and/or modify
  7. ;;   it under the terms of the GNU General Public License as published by
  8. ;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
  9. ;;   Boston MA 02111-1307, USA; either version 2 of the License, or
  10. ;;   (at your option) any later version; incorporated herein by reference.
  11. ;;
  12. ;; -----------------------------------------------------------------------
  13.  
  14. ;;
  15. ;; regdump.inc
  16. ;;
  17. ;; Dump as much as possible of the register state; for debugging
  18. ;;
  19.  
  20. disk_dumpregs:
  21.     mov ah,02h
  22.     call dumpregs
  23.     int 13h
  24.     ret
  25.  
  26. dumpregs:
  27.     push gs
  28.     push fs
  29.     push es
  30.     push ds
  31.     push ss
  32.     push cs
  33.     pushad
  34.     pushfd
  35.  
  36.     push cs
  37.     pop ds
  38.  
  39.     mov bp,sp
  40.     mov di,regnames
  41.  
  42.     mov cx,9        ; 9 32-bit registers
  43. .reg8:
  44.     mov si,[di]
  45.     inc di
  46.     inc di
  47.     call cwritestr
  48.     mov eax,[bp]
  49.     add bp,4
  50.     call writehex8
  51.     loop .reg8
  52.  
  53.     mov cx,7        ; 6 16-bit registers
  54. .reg4:
  55.     mov si,[di]
  56.     inc di
  57.     inc di
  58.     call cwritestr
  59.     mov eax,[bp]
  60.     inc bp
  61.     inc bp
  62.     call writehex4
  63.     loop .reg4
  64.  
  65.     call crlf
  66.  
  67.     popfd
  68.     popad
  69.     add sp,4        ; Skip CS, SS
  70.     pop ds
  71.     pop es
  72.     pop fs
  73.     pop gs
  74.     ret
  75.  
  76. regnames:
  77.     dw .eflags
  78.     dw .edi
  79.     dw .esi
  80.     dw .ebp
  81.     dw .esp
  82.     dw .ebx
  83.     dw .edx
  84.     dw .ecx
  85.     dw .eax
  86.     dw .cs
  87.     dw .ss
  88.     dw .ds
  89.     dw .es
  90.     dw .fs
  91.     dw .gs
  92.     dw .ip
  93.  
  94. .eflags    db 'EFL: ', 0
  95. .edi    db 13,10,'EDI: ', 0
  96. .esi    db ' ESI: ', 0
  97. .ebp    db ' EBP: ', 0
  98. .esp    db ' ESP: ', 0
  99. .ebx    db 13,10,'EBX: ', 0
  100. .edx    db ' EDX: ', 0
  101. .ecx    db ' ECX: ', 0
  102. .eax    db ' EAX: ', 0
  103. .cs    db 13,10,'CS: ',0
  104. .ss    db ' SS: ',0
  105. .ds    db ' DS: ',0
  106. .es    db ' ES: ',0
  107. .fs    db ' FS: ',0
  108. .gs    db ' GS: ',0
  109. .ip    db ' IP: ',0
  110.  
  111.  
  112.